import { getSearchDataApi } from '@/api/search'

const state = {
  // 搜索数据
  searchList: {}
}

const mutations = {
  SAVESEARCHList (state, params) {
    // 修改搜索数据
    state.searchList = params
  }
}

const actions = {
  async createSearchList ({ commit }, state) {
    // 请求搜索数据
    const res = await getSearchDataApi(state)
    if (res.code === 200) {
      commit('SAVESEARCHList', res.data)
    }
  }
}

const getters = {}

export default {
  namespaced: true,
  state,
  mutations,
  actions,
  getters
}
